<script>
/**
*	公共的详情页
*/
$(document).ready(function(){
	{params}
	var c = {
		num:'',
		cnum:'',
		funitid:'',
		istan:function(){
			return params.ismodal;
		},
		init:function(){
			this.num 	= params.num;
			this.mid 	= params.mid;
			this.name 	= params.name;
			if(params.cnum)this.cnum 	= params.cnum;
			if(params.funitid)this.funitid 	= params.funitid;
			importjs('xiang', function(){c.loadxiang();});
			var obj = $('#xiangtitle{rand}');
			this.resize();
			if(this.istan()){
				js.xiang.resize(this.num);
				obj.hide();
			}else{
				obj.html(this.name);
				xcy.resieze=function(){
					c.resize();
				}
			}
		},
		closetan:function(){
			if(this.istan()){
				js.xiang.close(this.num);
			}
			var tabid = params.tableid;
			if(tabid){
				if(js.table){
					try{
						var obj = js.table.getobj(tabid);
						if(obj)obj.reload();
					}catch(e){}
				}else{
					try{
						var obj = opener.js.table.getobj(tabid);
						if(obj)obj.reload();
					}catch(e){}
				}
			}
		},
		resize:function(){
			var hei = viewheight;
			if(get('xiangtitle{rand}').style.display!='none')hei -= 40;
			if(this.istan()){
				hei-=100;
				if(hei>560)hei = 560;
			}
			$('#xiangviews{rand}').css('height',''+hei+'px');
		},
		submit:function(o1){
			if(this.xiangobj)this.xiangobj.submit(o1);
		},
		loadxiang:function(){
			js.ajax.get({
				url:'api/flow/xiang?num='+this.num+'&mid='+this.mid+'',
				cnum:this.cnum,
				funitid:this.funitid,
				onsuccess:function(ret){
					c.loadshow(ret.data);
				},
				onerror:function(ret){
					$('#xiangview{rand}').html(ret.msg);
				}
			});
		},
		loadshow:function(da){
			this.fieldsarr 	= da.fieldsarr;
			this.moders 	= da.moders;
			var cans = {
				view:'xiangview{rand}',
				num:this.num,
				cnum:this.cnum,
				funitid:this.funitid,
				optobj:this,
				mid:this.mid,
				ismodal:params.ismodal,
				tableid:params.tableid,
				onsuccess:function(){
					c.closetan();
				}
			};
			for(var i in da)cans[i]=da[i];
			
			this.xiangobj	= new js.xiang.create(cans);
			if(this.istan())js.xiang.resize(this.num);
		},
		
		hidetitle:function(){
			$('#xiangtitle{rand}').hide();
			this.resize();
		},
		setTitle:function(tit){
			$('#xiangtitle{rand}').html(tit);
			xcy.setTitle(tit);
			this.resize();
		}
	}
	js.initbtn(c);
});
</script>

<div align="center">

	<div id="xiangtitle{rand}" style="padding-top:10px">tit</div>
	
	<div id="xiangviews{rand}" align="center" style="height:400px;overflow:auto" >
		<div id="xiangview{rand}">
			<div align="center"><i style="height:40px;width:40px" class="rock-loading"></i></div>
		</div>
	</div>
	
</div>